<?php

class VES_VendorsWarehourse_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
    public function __construct()
    {
        parent::__construct();
        $this->setId('suborderGrid');
        $this->setDefaultSort('id');
        $this->setDefaultDir('ASC');
        $this->setSaveParametersInSession(true);

    }
    protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel('sales/order_item_collection');
		$collection->addFieldToSelect('id');
        $this->setCollection($collection);
        parent::_prepareCollection();
        return $this;
    }
    protected function _prepareColumns()
    {
        
        $this->addColumn('id', array(
            'header'	=> $this->__('ID'),
            'align'		=> 'left',
            'index'		=> 'id',
        ));
        $this->addColumn('event_category_id', array(
            'header'	=> $this->__('Category Title'),
            'align'	    => 'left',
            'index' 	=> 'event_category_id',
        ));

        $this->addColumn('status', array(
            'header'	=> $this->__('Status'),
            'align'	    => 'left',
            'index' 	=> 'status',
        ));
        
        $this->addColumn('product_sku', array(
            'header'	=> $this->__('SKU'),
            'align'	    => 'left',
            'index' 	=> 'product_sku',
        ));
        
        $this->addColumn('price', array(
            'header'	=> $this->__('Price'),
            'type'       => 'number',
            'align'	    => 'left',
            'index' 	=> 'price',
        ));
        $this->addColumn('special_price', array(
            'header'	=> $this->__('Special Price'),
            'type'       => 'number',
            'align'	    => 'left',
            'index' 	=> 'special_price',
        ));
        $this->addColumn('discount', array(
            'header'	=> $this->__('Discount'),
            'type'      => 'number',
            'align'	    => 'left',
            'index' 	=> 'discount',
        ));
        
        $this->addColumn('inventory', array(
            'header'	=> $this->__('Inventory'),
            'type'      => 'number',
            'align'	    => 'left',
            'index' 	=> 'inventory',
        ));
        
        $this->addColumn('is_recommand', array(
            'header'	=> $this->__('Is Recommand'),
            'align'	    => 'left',
            'index' 	=> 'is_recommand',
        ));
        
        $this->addColumn('priority', array(
            'header'	=> $this->__('Priority'),
            'align'	    => 'left',
            'index' 	=> 'priority',
        ));
        
        $this->addColumn('sort', array(
            'header'	=> $this->__('Sort'),
            'align'	    => 'left',
            'index' 	=> 'sort',
        ));
        
        $this->addColumn('action', array(
                'header'    =>  $this->__('Action'),
                'type'      => 'action',
                'getter'    => 'getId',
                'actions'   => array(
                    array(
                        'caption'   => $this->__('Edit'),
                        'url'       => array('base'=> '*/*/edit'),
                        'field'     => 'id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',
                'is_system' => true,
        ));
        
        return parent::_prepareColumns();
    }

    protected function _prepareMassaction()
    {
        $this->setMassactionIdField('id');
        $this->getMassactionBlock()->setFormFieldName('promoteevents');

        $this->getMassactionBlock()->addItem('delete', array(
             'label'    => $this->__('Delete'),
             'url'      => $this->getUrl('*/*/massDelete'),
             'confirm'  => $this->__('Are you sure?')
        ));
        return $this;
    }

//     public function getRowUrl($row)
//     {
//         return $this->getUrl('*/*/edit', array('id' => $row->getId()));
//     }

}
